package com.tiku.controller;

import com.tiku.common.ResultJson;
import com.tiku.service.UserCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 小马不会跑
 * @create 2024-09-25 18:52
 */
@RestController
@RequestMapping("/collectons")
@CrossOrigin("*")
public class UserCollectionController {

    @Autowired
    private UserCollectionService userCollectionService;

    //保存收藏数据
    @GetMapping("/users/addCollection/{id}/{setMealId}/{csiId}")
    public ResultJson saveCollection(@PathVariable("id") String id,@PathVariable("setMealId")String setMealId,@PathVariable("csiId")String csiId){
        return  userCollectionService.addCollection(id,setMealId,csiId);
    }

    @GetMapping("/users/deleteCollection/{id}")
    public ResultJson deleteCollection(@PathVariable("id") String id){
        return  userCollectionService.deleteCollection(id);
    }

    //查询
    @GetMapping("/users/selectCollection/{setMealId}")
    public ResultJson selectCollection(@PathVariable("setMealId")String setMealId){
        return userCollectionService.selectCollection(setMealId);
    }

    @GetMapping("/users/selectCollections/{csiId}")
    public ResultJson selectCollections(@PathVariable("csiId") String csiId){
        return userCollectionService.selectCollections(csiId);
    }

    @GetMapping("/users/selectCollectionAssembly/{id}")
    public ResultJson selectCollectionById(@PathVariable("id") String id){
        return userCollectionService.selectCollectionAssembly(id);
    }

}
